package com.sweet.fourtimeoa.mapper;

import com.sweet.fourtimeoa.pojo.dto.PageDto;
import com.sweet.fourtimeoa.pojo.dto.RoomReserveDto;
import com.sweet.fourtimeoa.pojo.dto.RoomsQueryDto;
import com.sweet.fourtimeoa.pojo.entity.MeetingRooms;
import com.sweet.fourtimeoa.pojo.vo.RoomVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;
@Mapper
public interface RoomMapper {
    List<MeetingRooms> getRoomByTime(Date startTime, Date endTime);

    void reserve(Integer roomId, RoomReserveDto roomReserveDto);

    List<RoomVo> getRoomByUserId(Integer userId);

    void deleteRooms(List<Integer> updateIds);

    List<RoomVo> getAllReserveRoom(RoomsQueryDto roomsQueryDto);

    @Select("select room_id,room_name,description from meeting_rooms")
    List<MeetingRooms> getAllRoom();

    @Delete("delete from meeting_rooms where room_id = #{roomId}")
    void deleteRoomById(Integer roomId);

    @Select("select room_id,room_name,description from meeting_rooms where room_id = #{roomId}")
    MeetingRooms getRoomById(Integer roomId);


    void updateRoom(MeetingRooms meetingRooms);

    @Select("insert into meeting_rooms(room_name,description) values(#{roomName},#{description})")
    void addRoom(MeetingRooms meetingRooms);
}
